package bdqn.t09.service.impl;

import bdqn.t09.dao.AsCustomsMapper;
import bdqn.t09.pojo.AsCustoms;
import bdqn.t09.service.AsCustomsService;
import bdqn.t09.util.Pageinfo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.HashMap;
import java.util.Map;


@Service
public class AsCustomsServiceImpl implements AsCustomsService {

    @Resource
    private AsCustomsMapper asCustomsMapper;

    @Override
    public int deleteByPrimaryKey(Long id) {
        return asCustomsMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insert(AsCustoms record) {
        return asCustomsMapper.insert(record);
    }

    @Override
    public int insertSelective(AsCustoms record) {
        return asCustomsMapper.insertSelective(record);
    }

    @Override
    public List<AsCustoms> asCustomsList() {
        return asCustomsMapper.asCustomsList();
    }

    @Override
    public AsCustoms selectByPrimaryKey(Long id) {
        return asCustomsMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateByPrimaryKeySelective(AsCustoms record) {
        return asCustomsMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKeyWithBLOBs(AsCustoms record) {
        return asCustomsMapper.updateByPrimaryKeyWithBLOBs(record);
    }

    @Override
    public int updateByPrimaryKey(AsCustoms record) {
        return asCustomsMapper.updateByPrimaryKey(record);
    }

    @Override
    public Pageinfo selectAsAccountdetailMapper(String customname, Integer pageindex, Integer row) {
        Pageinfo pageinfo=new Pageinfo();
        pageinfo.setCurrIndex(pageindex);
        pageinfo.setRows(row);
        int count = asCustomsMapper.count(customname);
        pageinfo.setCount(count);
        Map map=new HashMap();
        int offset = (pageindex-1)*row;
        map.put("customname",customname);
        map.put("offset",offset);
        map.put("rows",row);
        List<AsCustoms> asCustoms = asCustomsMapper.findAsCustoms(map);
        pageinfo.setList(asCustoms);
        return  pageinfo;
    }

}